Skip to content

APPENG-5614 : Escape regex metacharacters in Function Caller Finder#281

Merged
RedTanny merged 2 commits into
RHEcosystemAppEng:mainfrom
RedTanny:APPENG-5614
Jul 8, 2026
Merged

APPENG-5614 : Escape regex metacharacters in Function Caller Finder#281
RedTanny merged 2 commits into
RHEcosystemAppEng:mainfrom
RedTanny:APPENG-5614

Conversation

@RedTanny

@RedTanny RedTanny commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

APPENG-5614: Fix regex escaping in function_name_extractor

Escape regex metacharacters (., [], +, etc.) in function name prefix so identifiers like "protojson.Unmarshal" or "[]byte" are treated as literals instead of regex patterns.

Note: The other changes from APPENG-5614 (pre-indexing, dedup, DFS ordering in chain_of_calls_retriever.py) are already in main.

Split from: #261

APPENG-5614: Fix regex escaping in function_name_extractor

Escape regex metacharacters (., [], +, etc.) in function name prefix
so identifiers like "protojson.Unmarshal" or "[]byte" are treated as
literals instead of regex patterns.

Note: The other changes from APPENG-5614 (pre-indexing, dedup, DFS
ordering in chain_of_calls_retriever.py) are already in main.

Split from: RHEcosystemAppEng#261

Signed-off-by: RedTanny <stanny@redhat.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@vbelouso

vbelouso commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Comment on lines 74 to 75

@zvigrinberg zvigrinberg Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RedTanny A Small suggestion related to the theme of the PR but not something introduced by the PR itself : to escape also metacharacters from extracted arguments/parameters if they're composite type like array and contains also maybe other metacharacters.

Suggested change
if (param.startswith("'") and param.endswith("'")) or (param.startswith('"') and param.endswith('"')):
return re.escape(param)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RedTanny RedTanny requested a review from zvigrinberg July 8, 2026 12:21

@zvigrinberg zvigrinberg left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RedTanny LGTM Approved.

@RedTanny RedTanny merged commit b98f330 into RHEcosystemAppEng:main Jul 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants